home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / System7 tools / Frontier / Frontier SDK 2.1 / Toolkits / Applet Toolkit / appletops.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-09  |  1.7 KB  |  123 lines  |  [TEXT/KAHL]

  1.  
  2. /*© Copyright 1988-1992 UserLand Software, Inc.  All Rights Reserved.*/
  3.  
  4.  
  5. #include <Processes.h>
  6. #include "appletdialogs.h"
  7. #include "appletstrings.h"
  8. #include "appletops.h"
  9.  
  10.  
  11. #ifdef MPWC
  12.  
  13.     #include <osevents.h>
  14.  
  15. #endif
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. void initmacintosh () {
  23.  
  24.     /*
  25.     the magic stuff that every Macintosh application needs to do 
  26.     before doing anything else.
  27.     */
  28.  
  29.     register short i;
  30.         
  31.     MaxApplZone ();
  32.     
  33.     for (i = 1; i < 11; i++) 
  34.         MoreMasters ();
  35.  
  36.     InitGraf (&quickdrawglobal (thePort));
  37.     
  38.     InitFonts ();
  39.     
  40.     FlushEvents (everyEvent, 0);
  41.     
  42.     InitWindows ();
  43.     
  44.     InitMenus ();
  45.     
  46.     TEInit ();
  47.     
  48.     InitDialogs (nil);
  49.     
  50.     InitCursor ();
  51.     
  52.     for (i = 1; i <= 5; i++) { /*register with Multifinder*/
  53.         
  54.         EventRecord ev;
  55.         
  56.         EventAvail (everyEvent, &ev); /*see TN180 -- splash screen*/
  57.         } /*for*/
  58.     } /*initmacintosh*/
  59.     
  60.  
  61. short minint (x, y) short x, y; {
  62.  
  63.     if (x < y)
  64.         return (x);
  65.     else
  66.         return (y);
  67.     } /*minint*/
  68.     
  69.     
  70. boolean cometofront () {
  71.     
  72.     register short i;
  73.     ProcessSerialNumber psn;
  74.     EventRecord ev;
  75.     
  76.     GetCurrentProcess (&psn);
  77.     
  78.     SetFrontProcess (&psn);
  79.     
  80.     for (i = 1; i <= 3; i++)
  81.         WaitNextEvent (nullEvent, &ev, 1, nil);    
  82.     } /*cometofront*/
  83.     
  84.     
  85. void delayticks (short ct) {
  86.     
  87.     long tc;
  88.     
  89.     tc = TickCount () + ct;
  90.     
  91.     while (TickCount () < tc) {}
  92.     } /*delayticks*/
  93.     
  94.     
  95. void delayseconds (ct) short ct; {
  96.     
  97.     delayticks (60 * ct);
  98.     } /*delayseconds*/
  99.     
  100.     
  101. void timestamp (stamp) long *stamp; {
  102.     
  103.     GetDateTime ((unsigned long *) stamp);
  104.     } /*timestamp*/
  105.     
  106.     
  107. boolean getstringlist (short listnum, short id, bigstring bs) {
  108.     
  109.     /*
  110.     the Mac routine GetIndString doesn't set ResError false when we fall off
  111.     the end of the indicated list, so we return false if the returned string
  112.     is of zero length.
  113.     */
  114.     
  115.     GetIndString (bs, listnum, id);
  116.     
  117.     return (stringlength (bs) > 0);
  118.     } /*getstringlist*/
  119.     
  120.     
  121.  
  122.     
  123.